package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.RefundPageQueryDTO;
import com.sky.entity.Payment;
import com.sky.entity.Refund;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface RefundMapper {
    // 查询所有需要退款的订单
    Page<Refund> pageQuery(RefundPageQueryDTO refundPageQueryDTO);

    // 更新支付状态为已退款
    @Update("update payment set payment_status = '已退款' where order_id = #{orderId}")
    void updatePaymentStatus(Long orderId);

    // 更新订单状态为已退款
    @Update("update booking_order set payment_status = '已退款' where order_id = #{orderId}")
    void updateOrderStatus(Long orderId);

    // 更新订单状态为拒绝退款
    @Update("update booking_order set payment_status = '已取消' where order_id = #{orderId}")
    void updateOrderStatusRefuse(Long orderId);

    // 更新支付状态为拒绝退款
    @Update("update payment set payment_status = '已取消' where order_id = #{orderId}")
    void updatePaymentStatusRefuse(Long orderId);
}
